package com.liujit.gateway.gray;

import org.springframework.cloud.loadbalancer.core.ServiceInstanceListSupplier;
import org.springframework.context.ConfigurableApplicationContext;
import org.springframework.context.annotation.Bean;

/**
 * @Description: 灰度部署配置
 * @Author: liujun
 * @Date: 2021/7/1 7:36 下午
 */
public class GrayServiceInstanceListSupplierConfiguration {

    @Bean
    ServiceInstanceListSupplier serviceInstanceListSupplier(ConfigurableApplicationContext context) {
        ServiceInstanceListSupplier delegate = ServiceInstanceListSupplier.builder().withDiscoveryClient().withCaching()
                .build(context);
        return new GrayServiceInstanceListSupplier(delegate);
    }
}
